<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    邮箱：<input type="text" id="inputs">
    <button id="btn">验证</button>



    <script>
        var inputs = document.querySelector('#inputs')
            // 邮箱以这些结束.com|.cn|.sina|.net
        var reg = /^[0-9a-zA-Z]{5,12}@(163|126|qq)\.(sina|cn|com|net)$/;
        var str = '12343442@163.sins'
        console.log(reg.test(str));
        // 给btn绑定点击事件
        btn.onclick = function() {
            str = inputs.value
            if (reg.test(str)) {
                alert('验证成功')
            } else {
                alert('请输入正确的邮箱地址')
            }
        }
    </script>
</body>

</html>